package com.example.tianyidemo.service.impl;

import com.example.tianyidemo.Mapper.PersonageupdateMapper;
import com.example.tianyidemo.pojo.User;
import com.example.tianyidemo.service.PersonageupdateService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;

@Service
public class Personageupdateimpl implements PersonageupdateService {
    private static final Logger logger = LoggerFactory.getLogger(Personageupdateimpl.class);
    //  service不能操作数据库，调用mapper接口

    @Autowired
    private PersonageupdateMapper personageupdateMapper;

    @Override
    public boolean updateUserData(User updatedUser) {
        // 假设userID是主键，这里直接使用了MyBatis注解的方式进行更新操作
        int rowsAffected = personageupdateMapper.updateByPrimaryKey(updatedUser);
        // 判断是否更新成功（是否有行受到影响）
        return rowsAffected > 0;
    }
}
